/*	
 *				
 *					ISNW ---- It is a war.It is not warcraft!
 *
 *
 *					Author:					zhoukeli(haxixi_keli)
 *					Filename:				CameraSceneNode.h
 *					CreateTime:				2008/12/27
 *					ModifyTime:				2008/12/27
 *
 */

#ifndef __ISNW_CAMERA_SCENE_NODE_H__
#define __ISNW_CAMERA_SCENE_NODE_H__

#include "include/ICameraSceneNode.h"
#include "include/Frustum.h"
#include "include/vector3d.h"

namespace ISNW
{
namespace scene
{
	class CameraSceneNode : public ICameraSceneNode
	{
	public:
		CameraSceneNode(ISceneManager*sm,ISceneNode* parent,s32 id,core::vector3df pos,
			core::vector3df target,core::vector3df up);
	public:
		virtual void setProjectiveMatirx(core::matrix4f projMatrix);

		virtual core::matrix4f getProjectiveMatrix() const;

		virtual void setViewMatrix(core::matrix4f viewMatrix);

		virtual core::matrix4f getViewMatrix() const;

		virtual void setTarget(core::vector3df target);

		virtual core::vector3df getTarget() const;

		virtual void setFov(f32 angle);

		virtual f32 getFov() const;

		virtual void setUpVec(core::vector3df upVec);

		virtual core::vector3df getUpVec() const;

		virtual void setNear(f32 n);

		virtual f32 getNear() const;

		virtual void setFar(f32 f);

		virtual f32 getFar() const;

		virtual void setAspectRadio(f32 aspect);

		virtual f32 getAspectRadio() const;

		virtual const Frustum& getFrustum() const;

		virtual void onRegisterSceneNode();

		virtual void render();

		virtual void setAll(f32 fo,f32 a,f32 n,f32 f)
		{
			fov = fo;
			aspect = a;
			Near = n;
			Far = f;
		}

	protected:
		void recalculateViewMatrix();

		void recalculateViewArea();

		void recalculateProjectiveMatrix();

	public:
		f32 fov;
		f32 aspect;
		f32 Near;
		f32 Far;

		core::vector3df target;

		core::vector3df upvec;

		Frustum viewArea;
	};
} // end namespace scene
} // end namespace ISNW
#endif